package com.etl.controller;

import com.etl.util.ResponseUtil;
import com.etl.util.ResultVO;
import com.etl.vo.EtlStatisticsVO;
import com.etl.service.IEtlStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

import static com.etl.util.ResponseUtil.error;
import static com.etl.util.ResponseUtil.success;

/**
 * 2020年06月11日 星期四
 */
@RestController
@RequestMapping("/statistics")
@Api(tags = {"任务统计管理"})
public class EtlStatisticsController {

    @Resource
    private IEtlStatisticsService etlStatisticsService;

    @ApiOperation(value = "总任务情况统计")
    @GetMapping(value = "/mainStatistics")
    public ResultVO<List<EtlStatisticsVO>> mainStatistics() {
        return ResponseUtil.success(etlStatisticsService.mainStatistics());
    }

    @ApiOperation(value = "任务执行耗时明细top10")
    @ApiImplicitParam(paramType = "query", name = "batch", value = "批次号", example = "1", required = true)
    @GetMapping(value = "/taskRunningTime")
    public ResultVO<String> taskRunningTime(Integer batch) {
        return ResponseUtil.success(etlStatisticsService.taskRunningTime(batch));
    }
}

